package com.xiehua.task.client.example;

import com.xiehua.task.annotation.Executor;
import com.xiehua.task.annotation.Task;
import com.xiehua.task.job.cron.CronSequenceGenerator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.text.SimpleDateFormat;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

//@Task(topic = "b2c_task")
public class B2cJob2 {

    private static Logger log = LoggerFactory.getLogger(B2cJob2.class);


    @Executor(cron = "0 */1 * * * ?")
    public void task2(){
        System.out.println("我是定时任务输出:B2cJob2->task2");
    }

    public static void main(String[] args) {
        String cron = "0 15 10 ? * *";
        CronSequenceGenerator cronSequenceGenerator = new CronSequenceGenerator(cron);
        LocalDateTime now = LocalDateTime.now();
        Date next = cronSequenceGenerator.next(Date.from(now.atZone(ZoneId.systemDefault()).toInstant()));
        System.out.println(next);
    }
}
